<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            background-color: skyblue;
        }
    </style>
</head>

<body>
    <div></div>
    <script>
        /* 
            点击 div，修改宽度，和背景颜色
            div.style 也是一个对象
            修改行内样式，用 style
        */
        let div = document.querySelector('div');

        div.onclick = function () {
            console.log(div.style);
            div.style.backgroundColor = "purple";
            div.style.width = '300px';
            div.style.height = "300px";
        }
    </script>
</body>

</html>